﻿using MediaAssistant.DAL.Helper;
using MediaAssistant.Management;
using NUnit.Framework;

namespace MediaAssistant.Tests
{
    [TestFixture]
    public class IMDBMovieScannerTest
    {
        [Test]
        public void FatherOfInvention()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\father.of.invention.720p.mkv", "Father of Invention");
        }
        [Test]
        public void CedarRapids()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\Cedar Rapids 2011 720p BRRip.mkv", "Cedar Rapids");
        }
        [Test]
        public void TheKingOfFighters()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\The King of Fighters 2010 BRRip.avi", "The King of Fighters");
        }
        [Test]
        public void LuckyNumberSlevin()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\Lucky_Number_Slevin_2006.avi", "Lucky Number Slevin");
        }
        [Test]
        public void FairGame()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\fair game brrip xvid.avi", "Fair Game");
        }
        [Test]
        public void SherlockHolmes()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\Sherlock.Holmes.BDRip.864p.mkv", "Sherlock Holmes");
        }
        [Test]
        public void Untraceable()
        {
            TestMovie(@"Z:\Movies\Hd_Movies\Untraceable.Dvdrip.ZBG-720p™-Imbt^Bdbluray.net^.mkv", "Untraceable");
        }
        private static void TestMovie(string fileName, string expectedMovieTitle)
        {
            var jsonObject = IMDBMovieScanner.GetMovieDetailsFromFileName(fileName);
            Assert.IsFalse(MediaHelper.HasError(jsonObject),"Movie Error");
            Assert.AreEqual(expectedMovieTitle, (string)jsonObject.SelectToken("Title"));
        }
    }
}
